-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
API: Simplify repeat signature #24447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
def repeat(self, repeats, *args, **kwargs): | ||
nv.validate_repeat(args, kwargs) | ||
def repeat(self, repeats, axis=None): | ||
nv.validate_repeat(tuple(), dict(axis=axis)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these could be written more explicitly as:
if axis is not None:
raise ValueError('...')
I don't think nv.validate_repeat
is doing more than that but could be missing something. The advantage to using nv.validate_repeat
simply being that the error message is kept in a single place instead of being explicitly written in each method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is exactly why we have it this way
lgtm. merge on green. |
Codecov Report
@@ Coverage Diff @@
## master #24447 +/- ##
==========================================
+ Coverage 92.3% 92.3% +<.01%
==========================================
Files 163 163
Lines 51977 51983 +6
==========================================
+ Hits 47979 47985 +6
Misses 3998 3998
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #24447 +/- ##
==========================================
+ Coverage 92.3% 92.3% +<.01%
==========================================
Files 163 163
Lines 51977 51983 +6
==========================================
+ Hits 47979 47985 +6
Misses 3998 3998
Continue to review full report at Codecov.
|
thanks @jschendel |
git diff upstream/master -u -- "*.py" | flake8 --diff
Doesn't seem like a whatsnew entry is needed here as the behavior from a user perspective should remain the same.
cc @TomAugspurger